<?php
pc_base::load_app_class('hchbase','hchindex',0);
class index extends hchbase {
	function __construct() {
		parent::__construct();
		$this->menuList = array(
			'institution'=>array('name'=>'投资人专区','url'=>'/index.php?m=hchstory&c=index&a=init&action=institution','index'=>'institution'),
			'doctor'=>array('name'=>'创业导师','url'=>'/index.php?m=hchstory&c=index&a=init&action=doctor','index'=>'doctor'),
			'people'=>array('name'=>'华创人物','url'=>'/index.php?m=hchstory&c=index&a=init&action=people','index'=>'people'),
			'knowledge'=>array('name'=>'创业知识','url'=>'/index.php?m=hchstory&c=index&a=knowledge&action=knowledge','index'=>'knowledge'),
		);
		
		$this->bulletInfo0 = '华创俱乐部 HCCLUB';
		$this->bulletInfo1 = '创业故事';
	}
	
	function init(){
		$subId = $_GET['sub_id']?$_GET['sub_id']:0;
        $action = $_GET['action']?$_GET['action']:'institution';
        $this->bulletInfo2 = $this->menuList[$action]['name'];
        $curURL = $this->menuList[$action]['url'];
        
        if($subId==0){
			$whereSql = " parent=13 AND name='".$action."'";
			$type = $this->dbType->get_one($whereSql,'id');
			$typeId = $type['id'];
			$whereSql = array('assort_type_id'=>$typeId,'is_del'=>0);
	        $orderSql = " id DESC";
            $lists = $this->db->select($whereSql,'*','',$orderSql);
            
        	include template ( 'common', '_list' );
        }else{
        	$whereSql = array('id'=>$subId);
        	$info = $this->db->get_one($whereSql,'*');
        	$infoId = $info['id'];
        	$browse = $info['browse_times'];
        	$isBrowse = true;
        	$info['content'] = htmlspecialchars_decode($info['content']);
        	 
        	include template ( 'common', '_item' );
        }
	}
	
	function knowledge(){
		$page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1;
		$subId = $_GET['sub_id']?$_GET['sub_id']:0;
        $action = $_GET['action']?$_GET['action']:'knowledge';
        $this->bulletInfo2 = $this->menuList[$action]['name'];
        $curURL = $this->menuList[$action]['url'];
        
        if($subId==0){
	        $whereSql = " parent=13 AND name='".$action."'";
			$type = $this->dbType->get_one($whereSql,'id');
			$typeId = $type['id'];
			$whereSql = array('assort_type_id'=>$typeId,'is_del'=>0);
	        $orderSql = " id DESC";
	        $lists = $this->db->listinfo($whereSql,$orderSql,$page,10);
			$pages = $this->db->pages;
        	 
			include template ( 'common', 'page_list' );
        }else{
        	$whereSql = array('id'=>$subId);
        	$info = $this->db->get_one($whereSql,'*');
        	$infoId = $info['id'];
        	$browse = $info['browse_times'];
        	$isBrowse = true;
        	$info['content'] = htmlspecialchars_decode($info['content']);
        	 
        	include template ( 'common', '_item' );
        }
	}
}
?>